<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   template="../WEB-INF/shared/masterlayout.xhtml"
   xmlns:c="http://java.sun.com/jsp/jstl/core"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:f="http://java.sun.com/jsf/core">
  <ui:define name="leftCol">
    <ui:include src="components/leftCol.xhtml"/>
  </ui:define>
  <ui:define name="rightCol">
      <h:form>
      <h1>Administrera flygplan</h1>
      <table class="manageTable">
        <thead>
            <tr>
                <td class="id">ID</td>
                <td class="name">Namn</td>
                <td class="seats">Antal saten</td>
                <td class="edit">Radera</td>
            </tr>
        </thead>
        <tbody>
        
        <ui:repeat  var="airplane" value="#{ManageAirplaneModel.listAllAirplanes()}">
                <tr>
                    <td class="name"><h:outputText value="#{airplane.id}"/></td>
                    <td class="name"><h:outputText value="#{airplane.model}"/></td>
                    <td class="name"><h:outputText value="#{ManageAirplaneModel.getSeats(airplane).size()}"/></td>
                    
                    <td><h:commandLink value="Radera" action="#{ManageAirplaneController.deleteAirplane}">
                        <f:setPropertyActionListener target="#{ManageAirplaneController.selectedAirplane}" value="#{airplane}" />
                    </h:commandLink>
                    </td>
                </tr>
            </ui:repeat>
        
        </tbody>
      </table>
      </h:form>
  </ui:define>
</ui:composition>